

<div class="col-md-12">
        <a data-toggle="modal" data-target=".invoice-modal"  href="/finance/invoice/create-new?finance_id=<?= $model->id?>" class="btn btn-primary">添加发票单</a>
</div>  


 <?php if($model->invoice){ ?>

        <div class="col-md-12" style="padding: 15px;">
          <div class="page-header">  
                <h4>发票列表</h4> 
                <h4 style="color: red">发票总金额：<?= Yii::$app->formatter->asCurrency($model->invoiceOrderPrice) ?></h4>
          <?php foreach($model->invoice as $invoice){ ?>
                <div class="col-md-12 panel panel-body">
                
                    <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne<?=$invoice->id?>" aria-expanded="true" aria-controls="collapseOne"> 发票单号: <?= $invoice->code ?> / <?=yii::$app->params['invoice_name'][$invoice->name]?> /
                     <?=$invoice->company?> / <?=yii::$app->params['invoice_status'][$invoice->status] ?> / <span style="color: red">总金额：<?=Yii::$app->formatter->asCurrency($invoice->OrderPrice)?></span>  </font></a>
                      
                      <?php if($invoice->status != 3){ ?>
                          <a href="/finance/invoice/update?id=<?=$invoice->id?>" title="修改" aria-label="修改" data-toggle="modal" data-target=".invoice-modal" style="margin-left:20px;color: #337ab7"><span class="glyphicon glyphicon-pencil"></span></a>
                      <?php }?>
                        
                    </h4> 

                     <div id="collapseOne<?=$invoice->id?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne" aria-expanded="false">
                        <div class="panel-body">
                             <ul class="list-group">
                          <?php if($invoice->invoiceOrder){ 
                                foreach($invoice->invoiceOrder as $inOrder){ ?>
                                   <li class="list-group-item"> 
                                   <a style="display:inline-block;width:140px;" href="/order/order/view?id=<?=$inOrder->order_id?>" target="_blank" ><?=$inOrder->order->code?> </a>  
                                   <font style="display:inline-block;width:100px;"><?= $inOrder->order->username ?></font>
                                    <font style="display:inline-block;width:100px;">  <?= $inOrder->order->phone ?></font>
                                    <font style="display:inline-block;width:200px;color: red">发票金额：
                                    <?=Yii::$app->formatter->asCurrency($inOrder->price)?></font>
                                    <!-- </?php if($invoice->status != 3){ ?>
                                    <font style="display:inline-block;width:100px;" >
                                    <a href="/finance/invoice/remove-order?id=</?=$inOrder->id?>" data-confirm="确认从审批中移除该订单吗?"><i class="fa fa-remove"></i></a>
                                    </font>
                                    </?php }?> -->
                                    </li>
                          <?php }  }?>    
                            </ul>
                         </div>      
                     </div>
                </div>    
          <?php }?>           
          </div>
        </div>  

    <?php }?>




<?php app\components\JsBlock::begin() ?>
<script type="text/javascript">  

     // 清除模态框缓存
    $(".invoice-modal").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
        $(this).find(".modal-content").html('');
        window.location.reload();
    });

</script>
<?php app\components\JsBlock::end() ?>